package com.study;

import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.persist.PersistService;
import com.google.inject.persist.jpa.JpaPersistModule;

public class App {
	public static void main(String[] args) {
		Injector injector = Guice.createInjector(new JpaPersistModule("DEV"));
		injector.getInstance(ApplicationInitializer.class);
		
		LoginUser user = new LoginUser();
		user.setUserName("user333");
		
		LoginUserDao dao = injector.getInstance(LoginUserDao.class);
		dao.insert(user);
		
		System.out.println("종료");
	}
}

class ApplicationInitializer {
	@Inject
	ApplicationInitializer(PersistService service) {
		service.start();
		// At this point JPA is started and ready.
		// other application initializations if necessary
	}
}